#include <iostream>
#include <Eigen/Dense>
#include <complex>
#include <fftw3.h>
#include "utils.h"
//#include "lte_para.h"
//#include "lte_type.h"
//#include "lte_para.h"
//#include "lte_getDefaultTM.h"

int main() {
    std::cout << "Hello, World!" << std::endl;

    Eigen::MatrixXd m = Eigen::MatrixXd::Random(3,3);
    m = (m + Eigen::MatrixXd::Constant(3,3,1.2))*50;
    std::cout << "m = " << std::endl << m << std::endl;

    const std::string path = "./test.txt";

    std::ofstream of2(path);
    of2.precision(6);
    const int N=128;

    fftw_complex *in, *out;
    fftw_plan p;

    in = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * N);
    out = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * N);


    for(int i=0;i<N;i++)
    {
        in[i][0]=sin(i)+sin(10*i)+sin(100*i);
        in[i][1]=0;
    }

    p = fftw_plan_dft_1d(N, in, out, FFTW_FORWARD, FFTW_ESTIMATE);

    fftw_execute(p); /* repeat as needed */

    for(int i=0;i<N;i++)
    {
        //of1<<in[i][0]<<","<<in[i][1]<<endl;
        of2<<out[i][0]<<","<<out[i][1]<<std::endl;
    }
    const std::string file = "tt.bin";
    writeBinaryFile(file.c_str(),  (void*) out, sizeof(fftw_complex)*N);

    fftw_destroy_plan(p);
    fftw_free(in);
    fftw_free(out);

    //std::map<std::string, int> Para;

    //auto len = init_para(BandWidth, 0, validBandwidths,6);

    //init_para(BandInfo);

    //for(auto it = BandInfo.begin(); it != BandInfo.end(); it++){
    //    std::cout << "Name: " << it->first << ", index: " << it->second << std::endl;
    //}


    return 0;
}
